﻿  
  /*中英文提示信息*/
  var tipsObj = {};
      function setTips_ch(){
          tipsObj.username_isNotEmpty = '请输入您的姓名';
          tipsObj.username_checkSpelChart = '姓名不可包含数字、特殊符号（除“-”、“·”外）';
          tipsObj.username_beginChineseLetter = '姓名必须以汉字或字母开头';
          tipsObj.username_rangelength = '姓名最少填写2个字符';

          tipsObj.contact_num0_isNotEmpty = '请输入您的手机号码';
          tipsObj.contact_num0_isMobileNum_11figure = '手机号码由11位数字组成';
          tipsObj.contact_num0_isMobileNum_section = '请输入正确的手机号码';
          tipsObj.contact_num0_isCover = '该手机号已注册，请重新输入';

          tipsObj.emailshow_isNotEmpty = '请输入您的电子邮箱';
          tipsObj.emailshow_isEmail = '请输入正确的电子邮箱';
          tipsObj.emailshow_checkEmail = '请输入正确的电子邮箱';
          tipsObj.emailshow_isMailCover = '该电子邮箱已注册，请重新输入';
          tipsObj.emailshow_isMailYahoor = '雅虎邮箱即将停止服务，请更换其他邮箱地址';

          tipsObj.hukou_isNotEmpty = '请选择您的户口所在地';

          tipsObj.residence_isNotEmpty = '请选择您的现居住地';

          tipsObj.sex_isNotEmpty = '请选择您的性别';
          tipsObj.birthDate_notEmpty = '请选择您的出生日期';

          tipsObj.personal_numberError = '身份证号码位数不对';
          tipsObj.personal_charError = '身份证号码含有非法字符';
          tipsObj.personal_mismatchBirth = '身份证号码与出生日期不一致';
          tipsObj.workYears_notEmpty = '请选择您的参加工作年份';
          tipsObj.person_card = "请输入您的证件号码";
      }
      function setTips_en(){
          tipsObj.username_isNotEmpty = 'Please enter your name';
          tipsObj.username_checkSpelChart = 'No numbers and special characters';
          tipsObj.username_beginChineseLetter = 'Name input starts with Chinese or English letter';
          tipsObj.username_rangelength = 'Name at least fill 2 characters';

          tipsObj.contact_num0_isNotEmpty = 'Please enter your Mobile';
          tipsObj.contact_num0_isMobileNum_11figure = 'Mobile consists of 11 digits';
          tipsObj.contact_num0_isMobileNum_section = 'Please enter the correct Mobile';
          tipsObj.contact_num0_isCover = 'The Mobile has been registered, please Re-enter';

          tipsObj.emailshow_isNotEmpty = 'Please enter your Email';
          tipsObj.emailshow_isEmail = 'Please enter the correct Email';
          tipsObj.emailshow_checkEmail = 'Please enter the correct Email';
          tipsObj.emailshow_isMailCover = 'The Email has been registered, please Re-enter';
          tipsObj.emailshow_isMailYahoor = 'Yahoo mail service stops, please change';

          tipsObj.hukou_isNotEmpty = 'Please select your HuKou';

          tipsObj.residence_isNotEmpty = 'Please select your Current City';

          tipsObj.sex_isNotEmpty = 'Please select your Gender';
          tipsObj.birthDate_notEmpty = 'Please select your Date of birth';

          tipsObj.personal_numberError = 'ID-digit error';
          tipsObj.personal_charError = 'ID card contains illegal characters';
          tipsObj.personal_mismatchBirth = 'Identity card number and date of birth is not consistent';
          tipsObj.workYears_notEmpty = 'Please select your Years of work';
          tipsObj.person_card = "Please enter your ID number";

      }
      if($('.main01 a').attr('href').indexOf('language=2') == -1){
          /*设置英文提示信息*/
          setTips_en();
      }else{
          /*设置中文提示信息*/
          setTips_ch();
      }

  $(function () {
         var positionCheck = {
              mouseFocustips:function(){

               },
             checkSpelChart:function(str){
                /*校验姓名不可包含数字、特殊符号（除“-”、“·”外）*/
                return /^[A-Za-z\u4e00-\u9fa5|\-|\. ]+$/.test(str);
             },
             beginChineseLetter:function(str){
                 /*校验姓名必须以汉字或字母开头*/
                 return /^[A-Za-z\u4e00-\u9fa5][A-Za-z\u4e00-\u9fa5|\-|\. ]+$/.test(str);
             },
             isMobileNum_11figure: function(str){
                 /*校验手机号码是否是11位数字，如果不是则提示'手机号码由11位数字组成'*/
                 return /^\d{11}$/.test(str);
             },
             isMobileNum_section: function(str){
                 /*校验手机号码是否为非正常号段，如果不是则提示'请输入正确的手机号码'*/
                 // return /^1[3|4|5|7|8]\d{9}$/.test(str);
                 return /^\d{11}$/.test(str);
             },
             isCover:function(str){
                  var $mible = $("#contact_num0");
                  if($mible.prop("disabled")== false){
                     return checkTelAjax(str);
                  }else{
                    return true;
                  }
             },
             isMailCover:function(str){
                 // var $email = $("#emailshow")
                 // if($email.prop("disabled")== false){
                 //    return checkMailAjax(str);
                 // }else{
                    return true;
                 // }
             },
             isMailYahoor : function(str){
                 return !(/@yahoo\.com\.cn$/.test(str) || /@yahoo\.cn$/.test(str));
             }
        };

       // ZPValidate.addRule("dontHaveSexismWords", positionCheck.dontHaveSexismWords, true);
        ZPValidate.addRule("checkSpelChart", positionCheck.checkSpelChart, true);
        ZPValidate.addRule("beginChineseLetter", positionCheck.beginChineseLetter, true);
        ZPValidate.addRule("isCover", positionCheck.isCover, true);
        /*校验手机号码是否是11位数字*/
        ZPValidate.addRule("isMobileNum_11figure", positionCheck.isMobileNum_11figure, true);
        /*校验手机号码是否为非正常号段*/
        ZPValidate.addRule("isMobileNum_section", positionCheck.isMobileNum_section, true);
        ZPValidate.addRule("isMailCover", positionCheck.isMailCover, true);
        /*校验雅虎邮箱，并提示'雅虎邮箱即将停止服务，请更换其他邮箱地址'*/
        ZPValidate.addRule("isMailYahoor", positionCheck.isMailYahoor, true);

        positionForm = new ZPValidate();
        positionForm.info.ok = "right_tips";   //错误信息
        positionForm.info.error = "error_tips";
        positionForm.info.focus = "focus_tips";
        positionForm.verifier.ok = "";          //input
        positionForm.verifier.error = "error_bor";
        positionForm.focusCls = "focus_bor";

        positionForm.add({
            id: "username", msgid: "txtError_username",
            rule: {
                datatype: "isNotEmpty,rangelength:2|50,checkSpelChart,beginChineseLetter",/*为了不改校验的库，而调整校验顺序，把长度校验放在datatype中*/
                isNotEmpty: tipsObj.username_isNotEmpty,
                rangelength: tipsObj.username_rangelength,
                checkSpelChart:tipsObj.username_checkSpelChart,
                beginChineseLetter:tipsObj.username_beginChineseLetter
          }
        });

       positionForm.add({
            id: "contact_num0", msgid: "txtError_contact0",
            rule: {
                datatype: "isNotEmpty,isMobileNum_11figure,isMobileNum_section,isCover",
                isNotEmpty: tipsObj.contact_num0_isNotEmpty,
                isMobileNum_11figure: tipsObj.contact_num0_isMobileNum_11figure,
                isMobileNum_section: tipsObj.contact_num0_isMobileNum_section,
                isCover:tipsObj.contact_num0_isCover
            }
        });

      positionForm.add({
            id: "emailshow", msgid: "conError_emailshowmessage",
            rule: {
                datatype: "isNotEmpty,checkEmail,isEmail,isMailYahoor,isMailCover",
                isNotEmpty: tipsObj.emailshow_isNotEmpty,
                isEmail:tipsObj.emailshow_isEmail,
                checkEmail:tipsObj.emailshow_isEmail,
                isMailCover:tipsObj.emailshow_isMailCover,
                isMailYahoor : tipsObj.emailshow_isMailYahoor
            }
        });
      var addTipClass = function(event){

          var $msg = $('#' + event.data.msgid);
          $msg.addClass(positionForm.info.focus);
          $msg.html(event.data.focusTips);
          $(event.target).unbind('focus',addTipClass);

      };

      var removeTipClass = function(event){
          var $msg = $('#' + event.data.msgid);
          $msg.removeClass(positionForm.info.focus);
          $(event.target).unbind('blur',removeTipClass);

      }
      $('#username').bind('focus', {msgid:'txtError_username', focusTips: tipsObj.username_isNotEmpty}, addTipClass);
      $('#username').bind('blur', {msgid:'txtError_username'}, removeTipClass);

      $('#contact_num0').bind('focus', {msgid:'txtError_contact0', focusTips: tipsObj.contact_num0_isNotEmpty}, addTipClass);
      $('#contact_num0').bind('blur', {msgid:'txtError_contact0'}, removeTipClass);

      $('#emailshow').bind('focus', {msgid:'conError_emailshowmessage', focusTips: tipsObj.emailshow_isNotEmpty}, addTipClass);
      $('#emailshow').bind('blur', {msgid:'conError_emailshowmessage'}, removeTipClass);

      /*使手机号码只能输入数字，还存在的问题：中文输入环境下可输入中文字符*/
      $('#contact_num0').on('keydown', function(event){
          var keyCode = event.keyCode;
          var shiftKey = event.shiftKey;
          /*
          *小键盘0-9的keyCode范围96 - 105  (event.keyCode < 96 || event.keyCode > 105)
          *Backspace退格键的keyCode 8，Delete退格键的keyCode 46，(event.keyCode != 8 && event.keyCode != 46)
          *方向键左、上、右、下的keyCode分别是37、38、39、40
          *键盘上方数字键0-9的keyCode范围48 - 57
          */
          if((keyCode >= 96 && keyCode <= 105) || keyCode == 8 || keyCode == 46 || keyCode == 37 || keyCode == 38 || keyCode == 39 || keyCode == 40
              || (keyCode >= 48 && keyCode <= 57 && !shiftKey)){
              /*只有当指定的键盘按键按下时才继续键盘的默认事件*/
              //console.log('------继续执行默认事件keyup-------')
          }else{
              /*否则阻止键盘按钮按下后的默认事件keyup*/
              event.preventDefault();
          }
      })
    });

 var checkTelAjax;
 var checkMailAjax;

 var sexOk = function(){
    $('#txtError_gender').removeClass(positionForm.info.error);
    $('.radio_group_container .jqTransformRadio').removeClass(positionForm.verifier.error);
    $('#txtError_gender').addClass(positionForm.info.ok);
    $('#txtError_gender').html('');
     return true;
 };

 var sexError = function(){
    $('#txtError_gender').removeClass(positionForm.info.ok);
    $('#txtError_gender').addClass(positionForm.info.error);
    /*此处添加样式positionForm.verifier.error只是用于标记校验不通过，为滚动条滑动添加一个标识*/
    $('.radio_group_container .jqTransformRadio').addClass(positionForm.verifier.error);
    $('#txtError_gender').html(tipsObj.sex_isNotEmpty);
     return false;
 };

 $(document).ready(function () {
  /*性别校验*/
  for(var step = 0,len = document.forms.length;step < len;step++){
      document.forms[step].reset()
  }
   
  $('.radio_group_container .widcheck').click(function(){
  	sexOk();
  })

  ZPIDC.addJob.InitRadio();
     checkTelAjax = function(obj) {
      var me = obj;
      //添加手机ajax请求验证
      var data = 'userName=' + $("#contact_num0").val() + '&t=' + (+new Date());
      var url = 'http://i.zhaopin.com/Login/LoginApi/VerifyUser'
      var result;
      $.ajax({
        type: "get",
        async: false,
        url: url,
        data: data,
        dataType: "jsonp", //数据类型为jsonp
        jsonp: "jsoncallback", //服务端用于接收callback调用的function名的参数
        success: function(msg) {
              var sta = parseInt(msg);
              if (sta == 1) {
                result = true;
              }else{
                result = false;
              }
        },
        error: function() {
          result = true;
        }
      });

      return result;
    }

    checkMailAjax = function(obj) {
      var me = obj;
      //添加邮箱ajax请求验证
      var data = 'userName=' + $("#emailshow").val() + '&timestamp=' + (+new Date());
      var url = 'http://i.zhaopin.com/Login/LoginApi/VerifyUser'
      var result;
      $.ajax({
        type: "get",
        async: false,
        url: url,
        data: data,
        dataType: "jsonp", //数据类型为jsonp
        jsonp: "jsoncallback", //服务端用于接收callback调用的function名的参数
        success: function(msg) {
          var sta = parseInt(msg);
          if (sta == 1) {

             result=true;
          }else{

            result=false;
          }
        },
        error: function() {
          result = true;
        }
      });
      return result;
    }

    /**
     * 页面表单验证
     * @returns {boolean}
     */

 $(".btn_next").click(function(){
     var flag_check_TYHC = submit_check_TYHC();
     var flag_check_PersonalCard = checkPersonalCard();
     var flag_check_validate = positionForm.validate();
     var flag_check_sex = $('.jqTransformRadio.jqTransformChecked').length > 0 ? sexOk() : sexError();


    var flag = flag_check_validate && flag_check_PersonalCard && flag_check_sex && flag_check_TYHC;
   // var $creatuserForm = $("form[name=frmMain]");
   if(!flag){
       /*当页面有校验不通过的项时，通过滚动条把该项滚动到浏览器可见区域中间；
       滚到条到顶部的距离是校验不通过元素到顶部的距离减去浏览器可见区域的一半*/
       var distanceTop = $('.error_bor:first').offset().top - $(window).height()/2
       $('body,html').animate({
           scrollTop: distanceTop || 100/*100为了防止没获取到distanceTop时代码出错*/
       });
       return false;
   }else{
       $("form[name=frmMain]")[0].submit();
   }
 })
   /*设置邮箱、证件input的maxlength属性*/
   $('#emailshow').attr('maxlength',100);
   $('#id_number').attr('maxlength',255);
   /*证件类型切换校验*/
   $(".select").each(function(index, element){
    
    $(element).bind('click',function(event){
      var  personSeletval = $(".txt").val();
      var  checkSelect = $(event.target);
      if(checkSelect !== personSeletval ){

        $("#id_number").val('');
        $("#id_number").blur();
      }
    })

   })
      /*身份证input获得焦点*/
      $('#id_number').bind('focus', function(){
          $(this).removeClass(positionForm.info.ok);
          $(this).removeClass(positionForm.info.error);
          $(this).addClass(positionForm.focusCls);

          $('#txtError_id_number').removeClass(positionForm.info.ok);
          $('#txtError_id_number').addClass(positionForm.info.focus);
          $('#txtError_id_number').html(tipsObj.person_card);
      });

       /*当选中身份证时当其后input绑定进行校验的blur*/
       var result = true;
       var $NumberInput = $('#id_number');
       var $MsgEm = $('#txtError_id_number');
       $NumberInput.bind('blur',function(event){
           var value =$.trim($NumberInput.val());
           $NumberInput.removeClass('focus_bor');
           $NumberInput.removeClass('error_bor');
           $MsgEm.removeClass('right_tips');
           $MsgEm.removeClass('error_tips');
           $MsgEm.removeClass('focus_tips');
           var selectorVal = $('#positionapplyreply_selector').find('h3').html();
           if(value != '' && (selectorVal == '身份证' || selectorVal == 'Personal ID Card')){
               /*身份证号码含有非法字符*/
               if(!/^\d+(\d|X|x)$/.test(value)){
                   /*输入值不正确时修改样式*/
                   $NumberInput.addClass('error_bor');
                   $MsgEm.addClass('error_tips');
                   $MsgEm.html(tipsObj.personal_charError);
                   result = false;
                   return;
               }
               /*身份证号码位数不对*/
               if(!/^(\d{14}|\d{17})(\d|X|x)$/.test(value)){
                   /*输入值不正确时修改样式*/
                   $NumberInput.addClass('error_bor');
                   $MsgEm.addClass('error_tips');
                   $MsgEm.html(tipsObj.personal_numberError);
                   result = false;
                   return;
               }

               /*如果身份证合法，校验身份证号中的生日与前面填写的出生年月是否一致*/
               var fill_year = $('#birth_date_y').val().toLowerCase().replace(/年|year/g,'');
               var fill_month = $('#birth_date_m').val().toLowerCase().replace(/月|month/g,'');
               /*当前面已经填写了生日时才校验生日是否与身份证生日一致*/
               if($.trim(fill_year) != '' && $.trim(fill_month) != ''){
                   fill_month = fill_month ? (fill_month.length == 1 ? '0' + fill_month : fill_month) : '';
                   /*获取身份证中的年月*/
                   var id_year_month = '';
                   if(value.length == 15){
                       /*15位的身份证年只有2位*/
                       id_year_month = value.substring(6, 10);
                   }else if(value.length == 18){
                       /*18位的身份证年有4位*/
                       id_year_month = value.substring(6, 12);
                       /*年有4位时把前2位去掉，但这样存在问题：相差100年时年的后两位可以相同，如1915，2015*/
                       id_year_month = id_year_month.substring(2);
                   }
                   var regexp_id_y_m = new RegExp(id_year_month);
                   /*判断身份证的年月和填写的年月是否一致*/
                   if(!regexp_id_y_m.test(fill_year + fill_month)){
                       /*输入值不正确时修改样式*/
                       $NumberInput.addClass('error_bor');
                       $MsgEm.addClass('error_tips');
                       $MsgEm.html(tipsObj.personal_mismatchBirth);
                       result = false;
                       return;
                   }
               }
               /*校验通过后修改样式*/
               $NumberInput.removeClass('error_bor');
               $MsgEm.addClass('right_tips');
               $MsgEm.html("");
               result = true;
           }else{
               //为空时修改样式
               $MsgEm.removeClass('right_tips');
               $MsgEm.html("");
               result = true;
           }
       })
       /*提交表单时如果选中身份证则执行校验*/
       function checkPersonalCard(){
           var selectorVal = $('#positionapplyreply_selector').find('h3').html();
           if(selectorVal == '身份证' || selectorVal == 'Personal ID Card'){
               $('#id_number').blur();
               return result;
           }else{
               return true;
           }
       }
     /*提交时校验出生年月、参加工作年份、户口所在地、现居住城市*/
     function submit_check_TYHC(){
         var check_result = true;
         if($.trim($('#birth_date_y').val()) == ''){
             check_result = false;
         }
         callBack_check($('#birth_date_y'), $('#txtError_birth_date_y'), tipsObj.birthDate_notEmpty);
         if($.trim($('#birth_date_m').val()) == ''){
             check_result = false;
         }
         callBack_check($('#birth_date_m'), $('#txtError_birth_date_y'), tipsObj.birthDate_notEmpty);
         if($.trim($('#expeButton').val()) == ''){
             check_result = false;
         }
         callBack_check($('#expeButton'), $('#conError_experience'), tipsObj.workYears_notEmpty);
         if($.trim($('#hukou_selete').val()) == ''){
             check_result = false;
         }
         callBack_check($('#hukou_selete'), $('#conError_hukou'), tipsObj.hukou_isNotEmpty);
         if($.trim($('#hukou_pp').val()) == ''){
             check_result = false;
         }
         callBack_check($('#hukou_pp'), $('#conError_residence'), tipsObj.residence_isNotEmpty);
         return check_result;
     }
     /*当鼠标悬停在证件下拉框时给当前a标签的class添加current。并移除其他a标签class中current*/
     $('#positionapplyreply_selector .select a').mouseover(function(){
         $(this).addClass('current').siblings().removeClass('current');
     });
     /*给证件添加keydown事件*/
     $('#positionapplyreply_selector').on('keydown', function(event){
         /*证件列表显示后再继续keydown事件*/
         if($('#positionapplyreply_selector .select').is(':visible') && (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13)){
             keyDown_UpDownEnter(event, $('#positionapplyreply_selector .select a'), setValue_enter_cred);
         }
     });
     // 点击更换下拉框背景图
     $("#positionapplyreply_selector").on("click",function(){
        if($(this).find("div").eq(1).is(':visible')){
          $(this).find("div").eq(0).addClass("select_txt2").removeClass("select_txt");
        }else{
          $(this).find("div").eq(0).addClass("select_txt").removeClass("select_txt2");
        }
     });
     /*在IE中由于div的blur不能被触发，所以定义一个标志用于控制显示或者隐藏div做的下拉框*/
     var flag_over = 1;
     $("#positionapplyreply_selector").on("mouseleave",function(){
        flag_over = 2;
     });
     $("#positionapplyreply_selector").on("mouseenter",function(){
        flag_over = 1;
     });
     $(document).on('click', function(event){
        if(flag_over == 2){
          $("#positionapplyreply_selector").find("div").eq(0).addClass("select_txt").removeClass("select_txt2");
          $("#positionapplyreply_selector").find("div").eq(1).hide();
        }
        flag_over = 1;
     });
     /*在证件下拉框展开时移动键盘的上下方向键改变下拉列表项的class*/
     function keyDown_UpDownEnter(event, $list_select, setValue_enter){
         if($list_select.length > 0){
             switch(event.keyCode){
                 case 38 : {
                     var currentIndex = 0;
                     $list_select.each(function(index, li){
                         if($(li).hasClass('current')){
                             currentIndex = index;
                             return false;
                         }
                     });
                     /*按向上的方向键到达最后一个li时停止*/
                     var previousIndex = currentIndex > 0 ? (currentIndex - 1) : 0;
                     $list_select.eq(previousIndex).addClass('current').siblings().removeClass('current');
                     event.preventDefault();
                     break;
                 }
                 case 40 : {
                     var currentIndex = -1, len = $list_select.length;
                     $list_select.each(function(index, li){
                         if($(li).hasClass('current')){
                             currentIndex = index;
                             return false;
                         }
                     });
                     /*按向下的方向键到达最后一个li时停止*/
                     var nextIndex = currentIndex < len - 1 ? (currentIndex + 1) : len - 1;
                     /*按向下的方向键到达最后一个li时，如果再继续按向下的方向键，则再从第一个li向下到最后一个li一直循环*/
//                     var nextIndex = currentIndex < len - 1 ? (currentIndex + 1) : (currentIndex == len - 1 ? 0 : len - 1);
                     $list_select.eq(nextIndex).addClass('current').siblings().removeClass('current');
                     event.preventDefault();
                     break;
                 }
                 case 13 : {
                     /*回车时input赋值的回调*/
                     setValue_enter();
                     event.preventDefault();
                     break;
                 }
             }
         }
     }
     /*如果展开了证件下拉框，按回车键时给证件框及对应隐藏的input赋值*/
     function setValue_enter_cred(){
         var $list_a = $('#positionapplyreply_selector .select a');
         if($list_a.length > 0){
             $list_a.each(function(index, ele_a){
                 var $a = $(ele_a);
                 if($a.hasClass('current')){
                     var text = $a.text();
                     $('#positionapplyreply_selector .select_txt2 h3').html(text).attr('title', text);
                     $('#id_type').val($a.attr('def-value'));
                     $list_a.parent().hide();
                     $list_a.parent().click();
                 }
             });
         }
     }
 });

  function callBack_check($input, $em,tip){
      $input.removeClass('error_bor');
      $input.removeClass('focus_bor');
      $em.removeClass('right_tips');
      $em.removeClass('error_tips');
      $em.removeClass('focus_tips');

      if($.trim($input.val()) == ''){
          $input.addClass('error_bor');
          $em.addClass('error_tips');
          $em.html(tip);
      }else{
          $em.addClass('right_tips');
          $em.html('');
      }
  }
 function callBack_changeColor($input,changecolor){

   $input.addClass(changecolor);

 }
function callBack_hukou(){

  callBack_check($('#hukou_selete'), $('#conError_hukou'), tipsObj.hukou_isNotEmpty);
}
function callBack_City(){

  callBack_check($('#hukou_pp'), $('#conError_residence'), tipsObj.residence_isNotEmpty);
}
function callBack_dateY(){

  callBack_changeColor($("#birth_date_y"),'changecolor');
  checkYearMonth();
}
function callBack_dateM(){

  callBack_changeColor($("#birth_date_m"),'changecolor');
  checkYearMonth();
}
function callBack_expeButton(){

  callBack_check($('#expeButton'), $('#conError_experience'), tipsObj.workYears_notEmpty);
}
/*校验出生年月，年和月必须都选择后才能显示检验通过的标志*/
function checkYearMonth(){
    var $year = $('#birth_date_y'), $month = $('#birth_date_m'), $em = $('#txtError_birth_date_y'),
    val_year = $.trim($year.val()), val_month = $.trim($month.val());

    $year.removeClass('error_bor');
    $month.removeClass('error_bor');
    $em.removeClass('right_tips');
    $em.removeClass('error_tips');
    /*年和月必须都有值并且选择后才能显示检验通过的标志*/
    if(val_year != '' && val_month != '' && $year.attr('class') && $year.attr('class').indexOf('changecolor') != -1
        && $month.attr('class') && $month.attr('class').indexOf('changecolor')!= -1){
        $em.addClass('right_tips');
        $em.html('');
    }else{
        if(val_year == '' || val_month == ''){
            val_year == '' ? $year.addClass('error_bor') : '';
            val_month == '' ? $month.addClass('error_bor') : '';
            $em.addClass('error_tips');
            $em.html(tipsObj.birthDate_notEmpty);
        }
    }
}

            